﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Ribbon_DualGroup : UserControl
{
    public enum GrpAlign { Left, Center, Right };

    private System.Collections.Generic.List<Control> _LeftItems;
    private System.Collections.Generic.List<Control> _RightItems;

    [PersistenceMode(PersistenceMode.InnerProperty)]
    public System.Collections.Generic.List<Control> LeftContentTemplate
    {
        get { return _LeftItems; }
        set { _LeftItems = value; }
    }

    [PersistenceMode(PersistenceMode.InnerProperty)]
    public System.Collections.Generic.List<Control> RightContentTemplate
    {
        get { return _RightItems; }
        set { _RightItems = value; }
    }

    public GrpAlign GroupAlign
    {
        set { this.ct_cell.Style.Add("text-align",value.ToString()); }
    }
    
    /// <summary>
    /// Text to show in the lower part of the group
    /// </summary>
    public string Text
    {
        get { return this.Literal1.Text; }
        set { this.Literal1.Text = value; this.tt_cell.Attributes["title"] = value; }
    }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (_LeftItems != null)
        {
            foreach (Control obj in _LeftItems)
            {
                this.PlaceHolder1.Controls.Add(obj);
            }
        }
        if (_RightItems != null)
        {
            foreach (Control obj in _RightItems)
            {
                this.PlaceHolder2.Controls.Add(obj);
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
